<include file="Public:header" />
<body class="gray-bg">
<div class="wrapper wrapper-content animated fadeInRight">
    <div class="row">
        <div class="col-sm-8">
            <div class="ibox float-e-margins">
                <div class="ibox-title">
                    <h5>用户资金</h5>
                    <div class="ibox-tools">
                        <a class="collapse-link">
                            <i class="fa fa-chevron-up"></i>
                        </a>
                        <a class="dropdown-toggle" data-toggle="dropdown" href="form_basic.html#">
                            <i class="fa fa-wrench"></i>
                        </a>
                        <a class="close-link">
                            <i class="fa fa-times"></i>
                        </a>
                    </div>
                </div>
                <div class="ibox-content">
					<div class="hr-line-dashed"></div>
                    <form class="form-horizontal m-t" id="insertForm" method="post" >
						<div class="form-group">
							<label class="col-sm-3 control-label">用户名:</label>
							<div class="input-group col-sm-4">
								<input id="shopName" type="text" value="{$info['username']}" disabled class="form-control" required="" aria-required="true">
							</div>
						</div>
						<volist name="currency" id="vo">
							<div class="form-group">
								<label class="col-sm-3 control-label">{$vo['name']}:</label>
								<div class="input-group col-sm-4">
									<input id="shopName" type="text" value="{$money_info[$vo['id']]['num']}" disabled class="form-control" name="shopName" required="" aria-required="true">
								</div>
							</div>
						</volist>
                    </form>
					<div class="ibox-title">
						<h5>修改用户资金</h5>
					</div>
					<form id='commentForm' role="form" method="get" class="form-horizontal m-t">
						<div class="form-group">
							<label class="col-sm-3 control-label">币种:</label>
							<div class="input-group col-sm-4">
								<select class="form-control" name="currency_id">
									<volist name="currency" id="vo">
										<option  value="{$vo['id']}">{$vo['name']}</option>
									</volist>
								</select>
							</div>
						</div>
						<div class="form-group">
							<label class="col-sm-3 control-label">类型:</label>
							<div class="input-group col-sm-4">
								<select class="form-control" name="type">
									<option  value="dec">扣除</option>
									<option  value="inc">增加</option>
								</select>
							</div>
						</div>
						<div class="form-group">
							<label class="col-sm-3 control-label">金额:</label>
							<div class="input-group col-sm-4">
								<input id="shopName" type="text" value="" class="form-control" name="num" required="" aria-required="true">
							</div>
						</div>
						<div class="form-group">
							<div class="col-sm-4 col-sm-offset-3">
                                <input value="{$info['id']}" class="form-control" name="user_id" type="hidden" required="" aria-required="true">
                                <button class="btn btn-primary" type="button" onclick="toVaild()">提交</button>
                            </div>
						</div>
                    </form>
                </div>
            </div>
            <div class="hr-line-dashed"></div>

        </div>
    </div>
</div>
<include file="Public:footer" />
<script type="text/javascript">

    //表单提交
    function toVaild(){
        var jz;
        var url = "{:U('UserMoney/changeMoneyFormSub')}";
        $.ajax({
            type:"POST",
            url:url,
            data: $('#commentForm').serialize(),// 你的formid
            async: false,
            beforeSend:function(){
                jz = layer.load(0, {shade: false}); //0代表加载的风格，支持0-2
            },
            error: function(request) {
                layer.close(jz);
                swal("网络错误!", "", "error");
            },
            success: function(data) {
                //关闭加载层
                layer.close(jz);
                if(data['status'] == true){
                    swal(data.info, "", "success");setTimeout("location.reload()",1000); 
                }else{
                    swal(data.info, "", "error");
                }

            }
        });

        return false;
    }

</script>
</body>
</html>